<template>
	<view class="main">
		<view class="title">
			{{title}}
		</view>
		<view class="summary">
			summary:{{summary}}
		</view>
		<view class="author_name">
			author:{{author_name}}
		</view>
		<rich-text class="content" :nodes="content"></rich-text>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '正加载title...',
				summary: '正加载summary...',
				author_name: '正加载author name...',
				content: '正加载content...'
			}
		},
		onLoad: function(e) {
			// 我们先看看e打印出来是什么.
			//{newsid: "5310906"}
			console.log("e="+e)
			uni.request({
				url: 'https://unidemo.dcloud.net.cn/api/news/36kr/'+e.newsid,
				method: "GET",
				data: {},
				success: (resp) => {
					console.log("resp.data=")
					console.log(resp.data)
					this.title = resp.data.title
					this.summary = resp.data.summary
					this.author_name = resp.data.author_name
					this.content = resp.data.content
				},
				fail: (e) => {
					console.log("request fail")
				},
				complete: (e) => {
					console.log("request complete")
				}
			});

		}
	}
</script>

<style>
	.title {
		font-size: large;
		font-weight: bold;
		color: #FF0000;
	}
</style>
